package com.dshore.messagecenter.util;

import java.util.ArrayList;
import java.util.List;

/**  
 *   
 * Page  
 *   
 *   
 * @version 1.0.0  
 * @param <T>
 *   
 */

public class Page<T> {

	/**
	 * 页大小
	 */
	private Integer limit=20;
	/**
	 * 总页数
	 */
	private Integer pageTotal;
	/**
	 * 开始位置
	 */
	private Integer start;
	/**
	 * 总记录数
	 */
	private Long total;
	/**
	 * 第几页
	 */
	private Integer offset;
	/**
	 * 数据行
	 */
	
	private List<T> rows=new ArrayList<T>();
	
	/**  
	 * pageTotal  
	 *  
	 * @return  the pageTotal  
	 * @since   1.0.0  
	 */
	
	public Integer getPageTotal() {
		return pageTotal;
	}
	/**  
	 * @param pageTotal the pageTotal to set  
	 */
	
	public void setPageTotal(Integer pageTotal) {
		this.pageTotal = pageTotal;
	}
	/**  
	 * start  
	 *  
	 * @return  the start  
	 * @since   1.0.0  
	 */
	
	public Integer getStart() {
		return start;
	}
	/**  
	 * @param start the start to set  
	 */
	
	public void setStart(Integer start) {
		this.start = start;
	}
	/**  
	 * total  
	 *  
	 * @return  the total  
	 * @since   1.0.0  
	 */
	
	public Long getTotal() {
		return total;
	}
	/**  
	 * @param total the total to set  
	 */
	
	public void setTotal(Long total) {
		this.total = total;
	}
	/**  
	 * list  
	 *  
	 * @return  the list  
	 * @since   1.0.0  
	 */
	
	
	private Page(){
		
	}
	
	  
	/**  
	 * ����һ���µ�ʵ�� Page.  
	 *  
	 * @param total
	 * @param offset  
	 */
	 
	public Page(Long total, Integer offset) {
		super();
		this.total = total;
		this.setOffset(offset);
		
	}
	  
	/**  
	 * ����һ���µ�ʵ�� Page.  
	 *  
	 * @param pageSize
	 * @param total
	 * @param offset  
	 */
	 
	public Page(Integer limit, Long total, Integer offset) {
		this.limit = limit;
		this.total = total;
		this.setOffset(offset);
		
	}
	
	
	  
	  
	/**  
	 * 创建一个新的实例 Page.  
	 *  
	 * @param limit
	 * @param total
	 * @param offset
	 * @param rows  
	 */
	 
	public Page(Integer limit, Long total, Integer offset, List<T> rows) {
		super();
		this.limit = limit;
		this.total = total;
		this.offset = offset;
		this.setRows(rows);
		
	}
	/**  
	 * 创建一个新的实例 Page.  
	 *  
	 * @param total
	 * @param offset
	 * @param rows  
	 */
	 
	public Page(Long total, Integer offset, List<T> rows) {
		super();
		this.total = total;
		this.offset = offset;
		this.setRows(rows);
	}
	
	  
	
	/**  
	 * offset  
	 *  
	 * @return  the offset  
	 * @since   1.0.0  
	 */  
	
	public Integer getOffset() {
		return offset;
	}
	/**  
	 * @param offset the offset to set  
	 */
	 
	public void setOffset(Integer offset) {
		this.offset = offset;
	}
	/**  
	 * rows  
	 *  
	 * @return  the rows  
	 * @since   1.0.0  
	 */  
	
	public List<T> getRows() {
		return rows;
	}
	/**  
	 * @param rows the rows to set  
	 */
	 
	public void setRows(List<T> rows) {
		this.rows = rows;
	}
	@Override
	public String toString() {
		return "Page [limit=" + limit + ", pageTotal=" + pageTotal + ", start=" + start + ", total=" + total
				+ ", offset=" + offset + ", rows=" + rows + "]";
	}
	
	
}
